package com.itboye.system.helper;


import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.SynchronousQueue;

/**
 * Created by hebidu on 16/5/9.
 */
public class ByDateHelper {


    /**
     * 获取当前时间微妙
     * @return 时间微妙
     */
    public static Long getCurrentTimeMillis(){
        return System.currentTimeMillis();
    }

    /**
     * 获取十六进制的时间戳
     * @return
     */
    public static String getHexTimestamp(){
        Long timestamp = ByDateHelper.getCurrentTimeStamp();
        String hexTimestamp = Integer.toHexString(timestamp.intValue());
        return hexTimestamp;
    }

    /**
     * 获取十六进制的时间戳
     * @return
     */
    public static String getHexNanoTime(){
        Long timestamp = System.nanoTime();
        return Long.toHexString(timestamp);
    }

    /**
     * 获取当前时间戳
     * @return 时间戳数值
     */
    public static Long getCurrentTimeStamp(){

        Long curTimeStamp = System.currentTimeMillis() / 1000;

        return curTimeStamp;
    }

    /**
     * 获取默认日期的描述信息
     * @return
     */
    public static String getDefaultDateFormatStr(){
        Date date = new Date();

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");

        return simpleDateFormat.format(date);

    }

}
